﻿#region

using AutoMapper;
using HouseHoldBudget.Core.Entities.Budgets;
using HouseHoldBudget.Core.Entities.Expenses;
using HouseHoldBudget.Core.Entities.Incomes;
using HouseHoldBudget.Core.Entities.User;
using HouseHoldBudget.Models.Budgets;
using HouseHoldBudget.Models.Expenses;
using HouseHoldBudget.Models.Incomes;
using HouseHoldBudget.Models.User;

#endregion

namespace HouseHoldBudget.Infrastructure
{
    public class AutoMapperStartupTask
    {
        #region Class Methods

        public static void Configure()
        {
            //Budget
            Mapper.CreateMap<Budget, BudgetModel>()
                .ForMember(dest => dest.BudgetOwner, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetActors, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetCategories, mo => mo.Ignore());
            Mapper.CreateMap<BudgetModel, Budget>()
                .ForMember(dest => dest.BudgetOwner, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetActors, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetCategories, mo => mo.Ignore());

            //Budget
            Mapper.CreateMap<Budget, BudgetResultModel>()
                .ForMember(dest => dest.BudgetOwner, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetActors, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetCategories, mo => mo.Ignore());
            Mapper.CreateMap<BudgetResultModel, Budget>()
                .ForMember(dest => dest.BudgetOwner, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetActors, mo => mo.Ignore())
                .ForMember(dest => dest.BudgetCategories, mo => mo.Ignore());

            //BudgetCategory
            Mapper.CreateMap<BudgetCategory, BudgetCategoryModel>();
            Mapper.CreateMap<BudgetCategoryModel, BudgetCategory>();

            //FixedIncome
            Mapper.CreateMap<FixedIncome, FixedIncomeModel>();
            Mapper.CreateMap<FixedIncomeModel, FixedIncome>();

            //Expense
            Mapper.CreateMap<Expense, ExpenseModel>();
            Mapper.CreateMap<ExpenseModel, Expense>();

            //FixedIncome
            Mapper.CreateMap<OccasionalIncome, OccasionalIncomeModel>();
            Mapper.CreateMap<OccasionalIncomeModel, OccasionalIncome>();

            //BudgetUser
            Mapper.CreateMap<BudgetUser, BudgetUserModel>();
            Mapper.CreateMap<BudgetUserModel, BudgetUser>();

            //ExpenseType
            Mapper.CreateMap<ExpenseType, ExpenseTypesModel>();
            Mapper.CreateMap<ExpenseTypesModel, ExpenseType>();
        }

        #endregion
    }
}